module TagHelper

  # Returns an unsorted list of all tags with weight
  def tags_weight
    tags = Hash.new(10)
    @items.select{ |i| i.path =~ /news/}.each do |i|
      if not i[:imagelist].nil?
        i[:imagelist].each do |img|
          img[:tags].each do |t|
            tags[t] += 1
          end
        end
      end
    end
    tags
  end

  def tags_text(tags)
    tags.join(', ') unless tags.nil?
  end
end
